//
//  YZBaseAPI.h
//  VET
//
//  Created by Lam BG on 2018/6/26.
//  Copyright © 2018年 YZ. All rights reserved.
//

#import <Foundation/Foundation.h>

@interface YZBaseAPI : NSObject

#pragma mark -

/**
 传递参数
 */
@property (nonatomic, strong) NSMutableDictionary *params;

/**
 header 传递参数
 */
@property (nonatomic, strong) NSMutableDictionary *headerParams;

/**
 请求 Domain
 */
@property (nonatomic, copy) NSString *urlDomain;

/**
 请求 action
 */
@property (nonatomic, copy) NSString *action;

/**
 请求是否有菊花
 */
@property (nonatomic, assign) BOOL showLoadingStatus;

/**
 模拟请求时的假数据
 */
@property (nonatomic, copy) NSString *fakeData;


+ (instancetype)api;

// 添加参数方法
- (void)addParam:(NSString*)key value:(id)value;
- (void)addParams:(NSDictionary*)values;

- (void)addHeaderParam:(NSString*)key value:(id)value;
- (void)addHeaderParams:(NSDictionary*)values;

/**
 发起请求
 */
- (RACSignal*)getRequest;
- (RACSignal*)postRequest;
- (RACSignal*)putRequest;
- (RACSignal*)deleteRequest;
- (RACSignal*)patchRequest;

/**
 模擬请求
 */
- (RACSignal*)fakeRequest;

#pragma mark- private funciton

- (void)requestBegin;
- (void)requestEnd;
- (void)showErrorInfo:(NSError*)error;

@end
